/*
 * Regola grammaticale:
 * <fact> → OPAR1 <expr> CPAR1
 * 
 * Simboli terminali:
 * OPAR1 → "["
 * CPAR1 → "]"
 */
package composite.number_expression.fact;

import composite.Component;
import composite.number_expression.Expr;
import composite.number_expression.Fact;
import visitor.Visitor;

/**
 *
 * @author Antonio
 */
public class FactExpr extends Fact {

    private Expr expr;

    public FactExpr(Expr expr) {

        if (expr == null) {

            throw new NullPointerException();
        }

        this.expr = expr;
    }

    public Expr getStato() {

        return expr;
    }// getStato

    @Override
    public void interpreta(String contesto) {

        expr.interpreta(contesto);

    }

    @Override
    public void accept(Visitor v) {

        v.visit(this);
    }

    @Override
    public String toString() {

        StringBuilder sb = new StringBuilder();

        return sb.append(" [").append(expr).append("] ").toString();
    }

    @Override
    public void add(Component c) {
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
